/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.ieslaferreria.creditsintesis.logicgame;



import com.jme.math.Vector3f;
import edu.ieslaferreria.creditsintesis.logicgame.actions.ConfigurationMapEvent;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Queue;

/**
 * En esta clase guardamos todos los objetos que se crean en un HashMap
 * Los que tiene cambios de posición se añaden en una Lista y se van trantando
 * de forma que se van quitando de la lista una vez tratdos
 * También guarda un RegionMap que controla sobre que región del mapa
 * miramos si los obj
 * @author Administrador
 */
public class ActionStatesHash1 implements ActionStates {

    private RegionMap allObjects = new RegionMap(new Vector3f(1024, 1024, 1024), 1);
    private HashMap<String,Vector3f> allObjectsPos = new HashMap();
    private LinkedList<ObjectWithStates> toValidateState = new LinkedList();
    private ConfigurationMapEvent eventMap;
//    private LinkedList<MobilObject> toValidatePosition = new LinkedList();
//    private LinkedList<ObjectWithStates> validated = new LinkedList();

    /*JC: I think you need just two queues */
//    private LinkedList<ObjectWithStates> toChange = new LinkedList();

   public void ActionSatesHash1 (){
       }


    
    public Queue<ObjectWithStates> getObjectsToValidateState() {
        return this.toValidateState;
    }

    public Iterator<ObjectWithStates> getObjectsNearMe(ObjectWithStates objw) {
        return this.allObjects.getObjectsWithStatesNearTo(objw.getWorldTranslation());
    }
    public void addObject(ObjectWithStates object) {
        this.allObjects.add(object);
    }

    public void addObjectPos(ObjectWithStates object){
        this.allObjectsPos.put(object.getName(),object.getLocalTranslation());
    }


	/**
	 * @return allObjectsPos 
	 *  
	 */
	public HashMap<String,Vector3f> getAllObjectsPos(){
        return this.allObjectsPos;
    }

    public void positionObjectWithStatesChanged(ObjectWithStates ob
                                            , Vector3f oldPossition
                                            , Vector3f newPosition){
        this.allObjects.positionObjectWithStatesChanged(ob, oldPossition,
                                                                newPosition);
    }

    
    public Iterator<ObjectWithStates> getAllObjects() {
        return this.allObjects.getAllObjectsWithStates();
    }

    /**
     * @return the eventMap
     */
    public ConfigurationMapEvent getEventMap() {
        return eventMap;
    }

    /**
     * @param eventMap the eventMap to set
     */
    public void setEventMap(ConfigurationMapEvent eventMap) {
        this.eventMap = eventMap;
    }

}